import java.awt.List;
import java.util.ArrayList;


public class BoxListWidget {
	private List list;
	private ArrayList<Integer> indexTable;
	private int id;
	public static BoxListWidget instance;
	
	private BoxListWidget(){
		list = new List();
		indexTable = new ArrayList<Integer>();
		id =0;
	}
	
	public static BoxListWidget getInstance(){
		if (null == instance) { // Premier appel
            instance = new BoxListWidget();
        }
        return instance;
	}

	public List getList() {
		return list;
	}
	public void setList(List list) {
		this.list = list;
	}
	
	public void add(int index){
		list.add("Box "+ id );
		id++;
		indexTable.add(index);
	}
	
	public void remove(int index){
		list.remove(index );
		indexTable.remove(index);
	}
	
	public void clear(){
		list.removeAll();
		indexTable.clear();
		id=0;
	}
	
}
